const path=require('path')


const htmlPlugin=require('html-webpack-plugin')
const htmlPluginObj=new htmlPlugin({
    template:path.join(__dirname,'./src/index.html'),
    filename:'index.html'
})


module.exports={
    // 入口
    entry:path.join(__dirname,'./src/main.js'),
    // 出口
    output:{
        path:path.join(__dirname,'./dist'),
        filename:'bundle.js'
    },
    plugins:[
        htmlPluginObj
    ],
    module:{
        rules:[
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.less$/,use:['style-loader','css-loader','less-loader']},
            {test:/\.scss$/,use:['style-loader','css-loader','sass-loader']},
            {test:/\.jpg|png|bmp|gif$/,use:'url-loader?name=[hash:8]-[name].[ext]'},
            {test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
            {test:/\.ttf|woff|woff2|eot|svg$/,use:'url-loader'},
            {test:/\.vue$/,use:'vue-loader'}
        ]
    }
}